package com.fms.gui.templateCreator.components.date.parts;

import java.text.SimpleDateFormat;

import javax.swing.JLabel;

import com.fms.gui.templateCreator.components.date.ITimeInformer;
import com.fms.gui.templateCreator.components.date.ITimeListener;

public class TimeLabel extends JLabel implements ITimeListener
{	
	/**
	 * 
	 */
	private static final long	serialVersionUID	= -5936711269518375115L;
	private ITimeInformer	informer;

	public TimeLabel(ITimeInformer _informer)
	{
		this.informer = _informer;
		informer.addTimeListener(this);
	}

	
	public void newTimePosted(int minute, int hour)
	{
		SimpleDateFormat format = new SimpleDateFormat("hh:mm a");
		
		this.setText(format.format(informer.getTime().getTime()));
	}
}
